package cn.wyl.feignclient.fallback;

import cn.wyl.domain.Course;
import cn.wyl.feignclient.BuyFeignClient;
import cn.wyl.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFactory implements FallbackFactory<BuyFeignClient> {


    @Override
    public BuyFeignClient create(Throwable throwable) {
        return new BuyFeignClient() {
            @Override
            public AjaxResult upd(Course course) {
                return AjaxResult.error().setMessage("系统繁忙,请重试");
            }

            @Override
            public AjaxResult findById(Long id) {
                return AjaxResult.error().setMessage("系统繁忙,请重试");
            }
        };
    }
}
